import random
import string
from random import shuffle

PREFIX = [
    '130', '131', '132', '133', '134', '135', '136', '137', '138', '139',
    '140', '141', '144', '145', '146', '147', '148', '149',
    '150', '151', '152', '153', '155', '156', '157', '158', '159',
    '165', '166', '167',
    '170', '171', '172', '173', '174', '175', '176', '177','178',
    '180', '181', '182', '183', '184', '185', '186', '187', '188', '189',
    '191', '198', '199'
]

def creat_psw():
    digits = string.digits    # 数字
    uppercase = string.ascii_uppercase   # 大写
    lowercase = string.ascii_lowercase   # 小写
    uderline = '_'               # 特殊字符
    allStr = digits+uppercase+lowercase+uderline

    stringList = []

    # 取3位 必须大小写字符+下划线
    stringList.append(random.choice(uppercase))
    stringList.append(random.choice(lowercase))
    stringList.append("_")

    # 取5到13位随机
    len = random.randint(5,13)
    for i in range(len):
        stringList.append(random.choice(allStr))

    shuffle(stringList)
    return "".join(stringList)

def creat_phone(n):
    accounts ={}
    psds =[]
    i = 0
    while i < n:
        prefix = random.choice(PREFIX)
        last = random.randint(10000000, 99999999)
        phone = '{}{}'.format(prefix, last)
        if phone in accounts:
            continue
        psd = creat_psw()
        if psd in psds:
            continue
        accounts[phone] = psd
        psds.append(psd)
        i += 1
    return [{'phone': k, 'password': v} for k, v in accounts.items()]


n = int(input('请输入你要的电话个数：'))
print(creat_phone(n))



